/**
 * 项目示例-列表表头
 * Date 2023-11-02 14:27:20
 * 可选参数可参考：https://element-plus.org/zh-CN/component/table.html#table-column-属性
 */

export const exampleColumns = [
  { type: 'selection',align:'center'},
  { type: 'index', label: '序号', width: 60, align: 'center' },
  {prop: 'attendanceMonth', label: '考核周期', minWidth: 100, align: 'center', ellipsis: true },
  {prop: 'staffName', label: '人员姓名', minWidth: 100, align: 'center', ellipsis: true },
  {prop: 'staffNumber', label: '人员编码/工号', minWidth: 120, sortable: true,  align: 'center', ellipsis: true,
      formatter: function (row: any, column: any, cellValue: any) {
          if (cellValue > 100 && cellValue != null){
              return cellValue
          }else return '-'
      }},
  // {prop: 'sshzl', label: '所属航站楼', minWidth: 80, align: 'center', ellipsis: true },
  {prop: 'score', label: '加分(+)', minWidth: 90, align: 'center', ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue > 100 && cellValue != null){
         let num= cellValue-100
        return num>0? num:'-'
      }else return '-'
    }
  },
  {prop: 'score', label: '减分(-)', minWidth: 90,align: 'center', ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue < 100 && cellValue != null) {
        let num= 100-cellValue
        return num>0? num:'-'
        }else return '-'
    }
  },
  {prop: 'score', label: '考核得分', minWidth: 200, sortable: true,align: 'center', ellipsis: true,
      formatter: function (row: any, column: any, cellValue: any) {
          if (cellValue > 100 && cellValue != null){
              return cellValue
          }else return '-'
      }},
  {prop: 'rating', label: '绩效等级', minWidth: 200,align: 'center', ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (row.score === null || row.score === ""){
        return '-'
      } else {
        return cellValue
      }
    }
  },
  {prop: 'award', label: '绩效奖励(+)', minWidth: 200, sortable: true,align: 'center', ellipsis: true,
      formatter: function (row: any, column: any, cellValue: any) {
          if (cellValue > 100 && cellValue != null){
              return cellValue
          }else return '-'
      }},
  {prop: 'deductions', label: '绩效扣罚(-)', minWidth: 200, sortable: true,align: 'center', ellipsis: true,
      formatter: function (row: any, column: any, cellValue: any) {
          if (cellValue > 100 && cellValue != null){
              return cellValue
          }else return '-'
      }},
  {prop: 'updateTime', label: '更新时间', minWidth: 200, sortable: true,align: 'center', ellipsis: true,
      formatter: function (row: any, column: any, cellValue: any) {
          if (cellValue > 100 && cellValue != null){
              return cellValue
          }else return '-'
      }},
  {
    prop: 'status', fixed: 'right', label: '状态', minWidth: 120, sortable: true,align: 'center', ellipsis: true,
    formatter: function (row: any, column: any, cellValue: any) {
      if (cellValue === 0) return "待发布"
      if (cellValue === 1) return "员工自评中"
      if (cellValue === 2) return "绩效评定中"
      if (cellValue === 3) return "待复核"
      if (cellValue === 4) return "已完成"
    }
  },{ prop: 'operate', label: '操作', fixed: 'right', width: 240, align: 'center', ellipsis: true }]


export const exampleHistoryColumns2 = [
    { type: 'index', label: '序号', width: 60, align: 'center' },
    {prop: 'onDuty', label: '日期', align: 'center' ,ellipsis: true,
        formatter: function (row: any, column: any, cellValue: any) {
            if (cellValue) return cellValue.substring(0,10)
        }
    },
    {prop: 'officeHours', label: '考勤时段', align: 'center' ,ellipsis: true,
        formatter: function (row: any, column: any, cellValue: any) {
            if (cellValue) return `${row.officeHours}-${row.closingTime}`
        }
    },
    {prop: 'onDuty', label: '上班打卡时间', align: 'center',ellipsis: true,
        formatter: function (row: any, column: any, cellValue: any) {
            if (cellValue) return cellValue.substring(10,16)
        }
    },
    {prop: 'offDuty', label: '下班打卡时间', align: 'center',ellipsis: true,
        formatter: function (row: any, column: any, cellValue: any) {
            if (cellValue) return cellValue.substring(10,16)
        }
    },
]
